"""Definition of the suggestion content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from my315ok.xtinfocontent import xtinfocontentMessageFactory as _

from my315ok.xtinfocontent.interfaces import Isuggestion
from my315ok.xtinfocontent.config import PROJECTNAME

suggestionSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.TextField(
        'text',
        storage=atapi.AnnotationStorage(),
        default_output_type = 'text/html',
        widget=atapi.RichWidget(
            label=_(u"suggestions"),
            description=_(u""),
        ),
        required=True,
    ),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

suggestionSchema['title'].storage = atapi.AnnotationStorage()
suggestionSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(suggestionSchema, moveDiscussion=False)


class suggestion(base.ATCTContent):
    """collect customer suggestions"""
    implements(Isuggestion)

    meta_type = "suggestion"
    schema = suggestionSchema
    _at_rename_after_creation = True

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    text = atapi.ATFieldProperty('text')


atapi.registerType(suggestion, PROJECTNAME)
